# 作者: 菅世博
# 2025年02月20日10时00分24秒
# 512326042@qq.com
class Person:
    def __init__(self, name, age, weight):
        """
        类的构造函数
        :param name:
        :param age:
        :param weight:
        """
        self.name = name
        self.age = age
        self.weight = weight

    def run(self):
        """
        跑步方法
        :return:
        """
        self.weight -= 0.5
        print(f"{self.name}跑步了,体重减少了0.5kg{self.weight}")

    def eat(self):
        """
        吃饭方法
        :return:
        """
        pass
        self.weight += 1
        print(f"{self.name}吃饭了,体重增加了1kg{self.weight}")


class Dog:
    def __init__(self, name, color):
        self.name = name
        self.color = color

    def bark(self):
        pass

    def shake(self):
        pass


if __name__ == '__main__':
    elephant = Person("大象", 20, 50)  # 实例化对象
    tiger = Person("老虎", 10, 20)

    elephant.run()  # 调用对象的方法
    elephant.eat()
    print(elephant.name, elephant.age, elephant.weight)  # 访问对象的属性

    print('-' * 50)
    print(dir(Person))  # 查看对象的属性和方法

    wangcai = Dog("旺财", "黄色")
    wangcai.bark()